package cn.tedu.tea.front.server.content.schedule;

import cn.tedu.tea.front.server.content.service.IArticleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 处理文章缓存的计划任务
 *
 * @author java@tedu.cn
 * @version 1.0
 */
@Slf4j
// @Component
public class ArticleCacheSchedule {

    @Autowired
    private IArticleService articleService;

    public ArticleCacheSchedule() {
        log.debug("创建计划任务组件对象：ArticleCacheSchedule");
    }

    @Scheduled(fixedRate = 2 * 60 * 1000)
    public void rebuildListCache() {
        log.debug("开始执行【重建缓存中的文章列表】的计划任务");
        articleService.rebuildListCache();
    }

}